const {User} = require('../../model/user');
module.exports =async (req,res)=>{
  req.app.locals.currentLink = 'user';
  let page = req.query.page || 1;
  let pageSize = 5;
  let count = await User.countDocuments({});
  let total = Math.ceil(count/pageSize);
  //页码对应的数据查询开始位置
  let start = (page-1)*pageSize;
  let users = await User.find({}).limit(pageSize).skip(start)
  res.render('admin/user',{
    users,
    page,
    total
  })
}